package com.jd.controller;

/**
 * ProjectName: soft3->R
 * Description: TODO：
 * Author: 丘丘
 * DateTime: 2024/12/29 21:25
 */
public class R {
    private Integer code;
    private Object data;
    private String msg;

    // 创建两种方法。静态返回
    public static R success(Integer code,Object data){
        return new R(code,data);
    }

    public static R success(Integer code,String msg){
        return new R(code,msg);
    }

    public static R failure(Integer code,String msg){
        return new R(code,msg);
    }


    public R() {
    }

    public R(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public R(Integer code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "R{" +
                "code=" + code +
                ", data=" + data +
                ", msg='" + msg + '\'' +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
